import axios from 'axios'
import apiUrls from 'common/api-urls'
import { contentTypeWww } from 'common/axio-decorate'

export function getCourseInfo(data) {
  return axios.get(`${apiUrls.getCourseInfo}/${data.id}`, {
    params: data
  })
}

export function updateCourse(data) {
  return axios.post(apiUrls.updateCourse, {
    ...data
  })
}

export function publishCourse(data) {
  data = JSON.parse(JSON.stringify(data))
  return axios.post(`${apiUrls.publishCourse}/${data.id}`, data, {
    headers: { 'Content-Type': contentTypeWww }
  })
}

export function unPublishCourse(data) {
  data = JSON.parse(JSON.stringify(data))
  return axios.post(`${apiUrls.unPublishCourse}/${data.id}`, data, {
    headers: { 'Content-Type': contentTypeWww }
  })
}
